﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Reflection;
using UnitTest.Context;

namespace UnitTest
{
    [TestClass]
    public class EntityFrameworkHelper
    {
        [TestMethod]
        public void DatabaseInititalTest()
        {
            this.DatabaseInitialize();
        }

        [TestMethod]
        public void DbContextTest()
        {
            //UserContext context = new UserContext();
            //context.Users.Add(new User { Age = 32, Name = "Jim" });
            //context.SaveChanges();
            //var ul = context.Users.ToList();
        }

        private void DatabaseInitialize()
        {
            string file = AppDomain.CurrentDomain.BaseDirectory + "/UnitTest.dll";
            Assembly assembly = Assembly.LoadFrom(file);
            DatabaseInitializer.AddMapperAssembly(assembly);
            DatabaseInitializer.Initialize();
        }
    }
}